home *** CD-ROM | disk | FTP | other *** search
- Path: dawn.mmm.com!news
- From: kjhopps@mmm.com (Kevin J Hopps)
- Newsgroups: comp.lang.c++
- Subject: Re: Q: 1 bit data type?
- Date: 19 Feb 1996 20:48:58 GMT
- Organization: 3M - St. Paul, MN 55144-1000 US
- Message-ID: <4gannq$4q7@dawn.mmm.com>
- References: <4g69if$edt@golden.ncw.net>
- Reply-To: kjhopps@mmm.com
- X-Newsreader: TIN [version 1.2 PL2]
-
- Kit Arbuckle (arbuckle@ncw.net) wrote:
- > Does anyone know how to set up a data type that contains only one
- > bit in BC452? I am currently using chars, but that is an awful waste of
- > space to store a boolean value. I know I could use masking or shifting of
- > bits, but this would be simpler. Thanks in advance...
-
- In a structure you can use a bit field, but unless you have several bit
- fields in sequence in the same structure, the members on either side of
- it will be on addressable boundaries anyway.
-
- Also, keep in mind that it probably takes more instructions to access a
- bit field than an entire char. Depending on the relative proportions of
- data vs. the code to access it, it might actually cost more space in
- instructions than it saves in data.
- --
- Kevin J. Hopps e-mail: kjhopps@mmm.com
- 3M Company phone: (612) 737-4643
- 3M Center, Bldg. 235-2D-57 fax: (612) 737-2700
- St. Paul, MN 55144-1000 Opinions are my own. I don't speak for 3M.
- But 3M speaks for me -- I did not write the following line:
-
- Opinions expressed herein are my own and may not represent those of 3M.
-